package com.web.surf.sample.eshop.faces.managed.beans;

import com.web.surf.sample.eshop.dto.interfaces.IProperty;
import com.web.surf.sample.eshop.faces.core.AbstractBean;

public class SectionBean extends AbstractBean{
	
	public enum SectionProperties implements IProperty {

		CATEGORY_ID("cat_id"),
		CATEGORY_NAME("cat_name"),
		SUBCATEGORY_ID("sub_id"),
		SUBCATEGORY_NAME("sub_name");

		private String databaseName;

		SectionProperties(String databaseName) {
			this.setDatabaseName(databaseName);
		}

		public void setDatabaseName(String databaseName) {
			this.databaseName = databaseName;
		}

		public String getDatabaseName() {
			return databaseName;
		}
	}
	
	public boolean equals(Object o) {
		if ((o instanceof SectionBean)&&(((SectionBean)o).getSubcategoryID()
				==this.getSubcategoryID())) {
			return true;
		}
		else {
			return false;		
		}
	}
	
	public int hashCode() {
		return this.getSubcategoryID().hashCode();
	}
	
	public String getCategoryID() {
		return getProperty(SectionProperties.CATEGORY_ID, String.class);
	}

	public String getCategoryName() {
		return getProperty(SectionProperties.CATEGORY_NAME, String.class);
	}
	
	public String getSubcategoryID() {
		return getProperty(SectionProperties.SUBCATEGORY_ID, String.class);
	}

	public String getSubcategoryName() {
		return getProperty(SectionProperties.SUBCATEGORY_NAME, String.class);
	}
	
	public void setCategoryID(String categoryID) {
		addProperty(SectionProperties.CATEGORY_ID, categoryID);
	}
	
	public void setCategoryName(String categoryName) {
		addProperty(SectionProperties.CATEGORY_NAME, categoryName);
	}		
	
	public void setSubcategoryID(String subcategoryID) {
		addProperty(SectionProperties.SUBCATEGORY_ID, subcategoryID);		
	}
	
	public void setSubcategoryName(String subcategoryName) {
		addProperty(SectionProperties.SUBCATEGORY_NAME, subcategoryName);		
	}		
	
}
